home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Graphics Programming (2nd Edition)
/
Visual Basic Graphics Programming 2nd Edition.iso
/
OldSrc
/
CH1
/
SRC
/
VIEWER.FRM
< prev
next >
Wrap
Text File
|
1995-12-18
|
4KB
|
155 lines
VERSION 4.00
Begin VB.Form ViewerForm
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Viewer"
ClientHeight = 4425
ClientLeft = 1275
ClientTop = 1365
ClientWidth = 6915
BeginProperty Font
name = "MS Sans Serif"
charset = 1
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 5115
Left = 1215
LinkTopic = "Form1"
ScaleHeight = 4425
ScaleWidth = 6915
Top = 735
Width = 7035
Begin VB.ComboBox PatternCombo
Appearance = 0 'Flat
Height = 315
Left = 120
Style = 2 'Dropdown List
TabIndex = 3
Top = 3960
Width = 2415
End
Begin VB.FileListBox filList
Appearance = 0 'Flat
Height = 1980
Left = 120
Pattern = "*.ico;*.bmp;*.wmf;*.dib"
TabIndex = 2
Top = 1920
Width = 2415
End
Begin VB.DirListBox dirList
Appearance = 0 'Flat
Height = 1380
Left = 120
TabIndex = 1
Top = 480
Width = 2415
End
Begin VB.DriveListBox drvList
Appearance = 0 'Flat
Height = 315
Left = 120
TabIndex = 0
Top = 120
Width = 2415
End
Begin VB.Image bigImage
Appearance = 0 'Flat
Height = 4215
Left = 2640
Top = 120
Width = 4215
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "ViewerForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Private Sub dirList_Change()
filList.Path = dirList.Path
End Sub
Private Sub drvList_Change()
On Error GoTo DriveError
dirList.Path = drvList.Drive
Exit Sub
DriveError:
drvList.Drive = dirList.Path
Exit Sub
End Sub
Private Sub filList_Click()
Dim fname As String
On Error GoTo LoadPictureError
fname = filList.Path + "\" + filList.filename
bigImage.Picture = LoadPicture(fname)
Caption = "Viewer [" & fname & "]"
Exit Sub
LoadPictureError:
Beep
Caption = "Viewer [Invalid picture]"
Exit Sub
End Sub
Private Sub Form_Load()
PatternCombo.AddItem "(*.bmp;*.ico;*.rle;*.wmf)"
PatternCombo.AddItem "Bitmap (*.bmp)"
PatternCombo.AddItem "Icon (*.ico)"
PatternCombo.AddItem "Run-Length Encoded (*.rle)"
PatternCombo.AddItem "Metafile (*.wmf)"
PatternCombo.AddItem "All Files (*.*)"
PatternCombo.ListIndex = 0
End Sub
Private Sub Form_Resize()
Const GAP = 60
Dim wid As Single
Dim hgt As Single
If WindowState = 1 Then Exit Sub
wid = drvList.Width
drvList.Move GAP, GAP, wid
PatternCombo.Move GAP, ScaleHeight - PatternCombo.Height - GAP, wid
hgt = (PatternCombo.Top - drvList.Top - drvList.Height - GAP) / 2
If hgt < 100 Then hgt = 100
dirList.Move GAP, drvList.Top + drvList.Height + GAP, wid, hgt
filList.Move GAP, dirList.Top + dirList.Height + GAP, wid, hgt
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub
Private Sub PatternCombo_Click()
Dim pat As String
Dim p1 As Integer
Dim p2 As Integer
pat = PatternCombo.List(PatternCombo.ListIndex)
p1 = InStr(pat, "(")
p2 = InStr(pat, ")")
filList.Pattern = Mid$(pat, p1 + 1, p2 - p1 - 1)
End Sub